function [mnX, mzX] = updatem(mnX, X, navg, zcidx, newK, mzX)
if exist('mzX', 'var')
    mzX = mzX.*(1-1/navg); mzX = [mzX, mnX(:,zcidx)./navg];
end
mnX = [mnX(:,~zcidx),zeros(size(X,1),newK)].*(1-1/navg) + X./navg;

end